package cn.cheln.explorer.beans;

import cn.cheln.explorer.config.Config;

public class UpdateBean {
	public String path;
	public String lastM;
	public String sort_key;
	public Integer id;

	public int flag;
	public Boolean dirtype;

	public UpdateBean(Integer id, String path, String size, String lastM,
			String sort_key,Boolean dirtype) {
		super();
		this.id = id;
		this.path = path;
		this.lastM = lastM;
		this.sort_key = sort_key;
		this.dirtype = dirtype;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((lastM == null) ? 0 : lastM.hashCode());
		result = prime * result + ((path == null) ? 0 : path.hashCode());
		result = prime * result
				+ ((sort_key == null) ? 0 : sort_key.hashCode());
		return result;
	}

	@Override
	public String toString() {
		return "UpdateBean [path=" + path + ", lastM=" + lastM + ", sort_key="
				+ sort_key + ", id=" + id + ", flag=" + flag + "]";
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UpdateBean other = (UpdateBean) obj;
		if (lastM == null) {
			if (other.lastM != null)
				return false;
		} else if (!lastM.startsWith(other.lastM))
			return false;
		if (path == null) {
			if (other.path != null)
				return false;
		} else if (!path.equals(other.path))
			return false;

		if (sort_key == null) {
			if (Config.versioncode == 13)
				return false;
			if (other.sort_key == null)
				return false;
		}
		return true;
	}

}
